using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerScrollState : PlayerAbilityState
{
    public PlayerScrollState(Player player, PlayerMoveData playerData, StateMachine stateMachine, string animBoolName) : base(player, playerData, stateMachine, animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
        player.SetBoxColliderData(playerData.scrollColliderOffset, playerData.scrollColliderSize);
        player.SetVelocityX(playerData.scrollVelocity * player.FacingDirection);
    }

    public override void LogicUpdate()
    {
        base.LogicUpdate();

        if (!isAbilityDone && (isAnimationFinish || xInput != 0 && xInput != player.FacingDirection)) 
        {
            isAbilityDone = true;
        }
    }

    public override void Exit()
    {
        base.Exit();
        player.SetBoxColliderData(playerData.standColliderOffset, playerData.standColliderSize);
    }
}
